import { Random } from "../System/Random";

export class RandomGenerator {

    private static random: Random;

    private static GetRandom(): Random {
        return this.random ??= new Random(70599);
    }

    public static RandInt32() {
        return this.GetRandom().Next();
    }

    public static RandUInt32() {
        return this.GetRandom().Next();
    }

    public static RandInt64() {
        const r1 = this.RandUInt32();
        const r2 = this.RandUInt32();
        return ((r1 << 32) | r2);
    }

    public static RandomNumber(lower: number, upper: number): number {
        const value = this.GetRandom().Next(lower, upper);
        return value;
    }

    public static RandomBool() {
        return this.GetRandom().Next(2) == 0;
    }

}